home *** CD-ROM | disk | FTP | other *** search
/ MacHack 1997 / MacHack 1997.toast / Hacks / Hacks ’96 / Booting Gallery / Booting Gallery (source) / (Libraries) / Sound Streaming / SoundInputDevice.h < prev    next >
Encoding:
Text File  |  1996-06-22  |  2.7 KB  |  103 lines  |  [TEXT/BROW]

  1. // SoundInputDevice.h
  2. // Created by Bill Hubauer on Sat, Jun 17, 1995 @ 5:55 PM.
  3.  
  4. #ifndef __SoundInputDevice__
  5. #define __SoundInputDevice__
  6.  
  7.  
  8. #ifndef __SOUNDINPUT__
  9. #include <soundinput.h>
  10. #endif
  11.  
  12. #ifndef __SSTYPES__
  13. #include "SSTypes.h"
  14. #endif
  15.  
  16. typedef pascal void (*SRecordCompletionProc)(OSErr    ioResult,UInt32 count,void* userData);
  17.  
  18. #define kDefaultDeviceName    "\p"
  19.  
  20. class CSoundInputDevice
  21. {
  22. public:
  23.     CSoundInputDevice(ConstStr255Param deviceName);    // pass kDefaultDeviceName
  24.     virtual ~CSoundInputDevice();
  25.     
  26.     OSErr    Open();
  27.     void    Close();
  28.     Boolean    OpenQ()        {return _openQ;}
  29.     
  30.     OSErr    Record(Ptr buffer,UInt32 bufSize,SRecordCompletionProc proc,void* userData);
  31.     
  32.         // channels
  33. //    enum SChannel { rightChannel = 1 , leftChannel = 2 , stereo = 3};
  34. //    OSErr        GetMaxChannels(UInt32&    numChannels) = 0;
  35. //    OSErr        SetNumChannels(UInt32    numChannelsToUse) = 0;
  36.       OSErr        GetNumChannels(UInt32&    numChannelsInUse);
  37. //    OSErr        SetActiveChannels(SChannel channel) = 0;
  38. //    OSErr        GetActiveChannels(SChannel& channel) = 0;
  39.     
  40.         // async support
  41.     OSErr        SupportsAsyncQ(Boolean&    asyncQ);
  42.     
  43.         // compression
  44. //    OSErr        GetNumCompressions(UInt32& numCompressions) = 0;
  45. //    OSErr        GetCompressionList(OSType* list,UInt32&    maxNumber) = 0;
  46.     OSErr        GetSoundHeader(SHeader& header,UInt32 numBytesInSound);
  47.     OSErr        GetCurrentCompression(OSType& compType);
  48. //    OSErr        GetCurrentCompressionFactor(UInt32& factor) = 0;
  49. //    OSErr        SetCurrentCompression(OSType compType) = 0;
  50.     
  51.         // info
  52. //    OSErr        GetDeviceName(Str255Param    name) = 0;
  53.         
  54.         // input sources
  55. //    OSErr        GetInputSourceIndex(UInt32& index) = 0;
  56. //    OSErr        SetInputSourceIndex(UInt32 index) = 0;
  57. //    OSErr        GetInputSourceCount(UInt32& numSources) = 0;
  58. //    OSErr        GetIndInputSource(UInt32 index,Str255Param name) = 0;
  59.  
  60.         // gain
  61.     OSErr        SetAutoGainControl(Boolean on);
  62.     OSErr        SetGain(Fixed newGain);
  63.     
  64.         // play thru
  65. //    OSErr        GetPlayThruStatus(Boolean& onQ) = 0;
  66. //    OSErr        SetPlayThruStatus(Boolean& offQ) = 0;
  67.     
  68.         // record settings
  69.         // siBestQuality , siBetterQuality, siGoodQuality
  70.     OSErr        SetGeneralQuality(OSType quality);
  71.     OSErr        GetGeneralQuality(OSType& quality);
  72.     
  73.         // sample rates
  74.     OSErr        GetSampleRate(Fixed&    rate);
  75. //    OSErr        SetSampleRate(Fixed        rate) = 0;
  76. //    OSErr        GetNumSampleRates(UInt32& numRates) = 0;
  77. //    OSErr        GetSampleRateList(Fixed*    rateList,UInt32& maxRates) =0;
  78.     
  79.         // sample sizes
  80.     OSErr        GetSampleSize(UInt32&    size);
  81. //    OSErr        SetSampleSize(UInt32    size) = 0;
  82. //    OSErr        GetNumSampleSizes(UInt32& numSizes) = 0;
  83. //    OSErr        GetSampleSizeList(UInt32*    list,UInt32&    numSizes) = 0;
  84.     
  85.     
  86. private:
  87.  
  88.     static pascal void _RecordCompletion(SPBPtr pb);
  89.     void                RecordCompletion(SPBPtr pb);
  90.  
  91.  
  92.     SInt32        _refNum;
  93.     Str255        _deviceName;
  94.     Boolean                    _openQ;
  95.     
  96.     long                    _saveGlobals;
  97.     SRecordCompletionProc    _recordCompletion;
  98.     void*                    _recordUserData;
  99.     SPB                        _pb;
  100. };
  101.  
  102. #endif
  103.